Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize productR in Apply #2728

Merged
merged 1 commit into from
Mar 4, 2019
Merged

Conversation

maphi
Copy link
Contributor

@maphi maphi commented Feb 11, 2019

Further improvement similar to #2597 . Resolves problems like this: typelevel/cats-effect#401 .

Reference to a was kept unnecessarily by prev implementation with map2:

//Expanding productR: map2 => product => ap => flatMap

fa *> fb == 
  fa
    .map(a => (b: B) => (a,b))
    .flatMap(f => fb.map(f)).map((_, b) => b)

@codecov-io
Copy link

codecov-io commented Feb 11, 2019

Codecov Report

Merging #2728 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2728   +/-   ##
=======================================
  Coverage   95.13%   95.13%           
=======================================
  Files         365      365           
  Lines        6799     6799           
  Branches      296      296           
=======================================
  Hits         6468     6468           
  Misses        331      331
Impacted Files Coverage Δ
core/src/main/scala/cats/Apply.scala 75% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ade01a...611bb48. Read the comment docs.

@kailuowang kailuowang self-requested a review March 3, 2019 13:11
Copy link
Contributor

@kailuowang kailuowang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. this reduced one map in map2 which is basically
map(ap(map(fa)(a => (b: B) => (a, b)))(fb))((_, b) => b)

@kailuowang
Copy link
Contributor

sorry about the delay, I missed this one while on vacation.

@kailuowang kailuowang requested a review from LukaJCB March 4, 2019 19:57
@LukaJCB LukaJCB merged commit 0246246 into typelevel:master Mar 4, 2019
@kailuowang kailuowang added this to the 2.0.0-M1 milestone Apr 18, 2019
rossabaker pushed a commit to rossabaker/cats that referenced this pull request May 26, 2019
rossabaker added a commit that referenced this pull request Jun 3, 2019
* Change MonadErrorOps#reject so it no longer runs effects twice (#2810)

* Add regression test for MonadErrorOps bug

* Change MonadErrorOps#reject so it no longer re-runs the effect it is called on. Fixes #2809

* Fix Order.max and Oder.min description comments (#2842)

Changed description to better fit their implentation

* Make WrappedMutableMapBase extend Serializable (#2784)

We are running into Spark `Task not serializable` issues when a closure
that executes on a Spark executor node involves a `Map` that is created
via running `foldMap` on a `List`. This commit makes the
`WrappedMutableMap` hierarchy extend `Serializable` and chex that the
cerealization works (this test failed before extending `Serializable`).

* Optimize productR in Apply (#2728)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants